#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <list>
#include "../../../NetEngine_Linux/NetEngine_SourceCode/XyRyNet_CommHdr.h"
#include "../../../NetEngine_Linux/NetEngine_SourceCode/XyRyNet_Types.h"
#include "../../../NetEngine_Linux/NetEngine_SourceCode/NetEngine_RfcComponents/RfcComponents_UPnpProtocol/UPnpProtocol_Define.h"
#include "../../../NetEngine_Linux/NetEngine_SourceCode/NetEngine_RfcComponents/RfcComponents_UPnpProtocol/UPnpProtocol_Error.h"

//g++ -std=gnu++11 -Wall -g Test_ForUPnp.cpp -o Test_ForUPnp -L ../../../NetEngine_Linux/NetEngine_Release/NetEngine_Release/NetEngine_BaseLib -L ../../../NetEngine_Linux/NetEngine_Release/NetEngine_Release/NetEngine_Core -L ../../../NetEngine_Linux/NetEngine_Release/NetEngine_Release/NetEngine_RfcComponents -lNetEngine_BaseLib -lNetEngine_Algorithm -lNetEngine_ManagePool -lNetEngine_Core -lNetClient_Socket -lRfcComponents_WSFrame -lpthread -Wl,-rpath=../../../NetEngine_Linux/NetEngine_Release/NetEngine_Release/NetEngine_BaseLib:../../../NetEngine_Linux/NetEngine_Release/NetEngine_Release/NetEngine_Core:../../../NetEngine_Linux/NetEngine_Release/NetEngine_Release/NetEngine_Client:../../../NetEngine_Linux/NetEngine_Release/NetEngine_Release/NetEngine_RfcComponents,--disable-new-dtags

//g++ -std=gnu++11 -Wall -g Test_ForUPnp.cpp -o Test_ForUPnp -L ../../../NetEngine_Linux/NetEngine_Release/NetEngine_Release/NetEngine_BaseLib -L ../../../NetEngine_Linux/NetEngine_Release/NetEngine_Release/NetEngine_Core -L ../../../NetEngine_Linux/NetEngine_Release/NetEngine_Release/NetEngine_RfcComponents -L ../../../NetEngine_Linux/NetEngine_Release/NetEngine_Release/NetEngine_NetHelp -lNetEngine_BaseLib -lNetEngine_Core -lNetHelp_APIHelp -lRfcComponents_UPnpProtocol -lpthread -Wl,-rpath=../../../NetEngine_Linux/NetEngine_Release/NetEngine_Release/NetEngine_BaseLib:../../../NetEngine_Linux/NetEngine_Release/NetEngine_Release/NetEngine_Core:../../../NetEngine_Linux/NetEngine_Release/NetEngine_Release/NetEngine_NetHelp:../../../NetEngine_Linux/NetEngine_Release/NetEngine_Release/NetEngine_RfcComponents,--disable-new-dtags

int main()
{
    int nCount = 0;
    XNETHANDLE xhToken;
    UPNPPROTOCOL_DEVICEINFO st_DeviceInfo;

    memset(&st_DeviceInfo, '\0', sizeof(UPNPPROTOCOL_DEVICEINFO));

    UPnpProtocol_Client_Create(&xhToken);
    UPnpProtocol_Client_MSearch(xhToken);
    UPnpProtocol_Client_GetCount(xhToken, &nCount);
    UPnpProtocol_Client_GetDeviceInfo(xhToken,&st_DeviceInfo);
    UPnpProtocol_Client_GetCtrlInfo(xhToken);

    TCHAR tszIPAddr[64];
    memset(tszIPAddr, '\0', sizeof(tszIPAddr));
    UPnpProtocol_Client_GetExternalIPAddress(xhToken, tszIPAddr);
    UPnpProtocol_Client_Close(xhToken);
    return 0;
}
